﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlatRedBall;
using FlatRedBall.Math.Geometry;
using FlatRedBall.Graphics.Animation;
using FlatRedBall.Content.AnimationChain;

namespace Runaway
{
    public class Coin : PositionedObject
    {
        private Sprite sprite;
        private AxisAlignedRectangle hitBox;
        private int value;
        private Boolean isActive;

        public Coin(float x, float y)
        {
            SpriteManager.AddPositionedObject(this);

            this.X = x;
            this.Y = y;

            value = 1;
            isActive = true;

            sprite = SpriteManager.AddSprite("Content/Prototype/Coin.jpg"); //INSERT PLACEHOLDER PNG HERE!
            sprite.AttachTo(this, false);
            sprite.PixelScale();
            
            
            hitBox = ShapeManager.AddAxisAlignedRectangle();
            hitBox.AttachTo(this, false);
            hitBox.ScaleY = sprite.ScaleY;
            hitBox.ScaleX = sprite.ScaleX;
            
        }
        public Coin(float x, float y, int worth)
        {
            SpriteManager.AddPositionedObject(this);

            this.X = x;
            this.Y = y;

            value = worth;
            isActive = true;

            sprite = SpriteManager.AddSprite("Content/Prototype/Coin.jpg"); //INSERT PLACEHOLDER PNG HERE!
            sprite.AttachTo(this, false);
            sprite.PixelScale();


            hitBox = ShapeManager.AddAxisAlignedRectangle();
            hitBox.AttachTo(this, false);
            hitBox.ScaleY = sprite.ScaleY;
            hitBox.ScaleX = sprite.ScaleX;

        }

        public AxisAlignedRectangle getHitBox()
        {
            return (hitBox);
        }

        public int getValue()
        {
            if (isActive)
            {
                return value;
            }
            else
            {
                return 0;
            }
        }
        public void setActive(Boolean isEconomicCollapse)
        {
            isActive = isEconomicCollapse;
        }
        public Boolean getActive()
        {
            return isActive;
        }
        public void Destroy()
        {
            isActive = false;
            SpriteManager.RemoveSprite(sprite);
            ShapeManager.Remove(hitBox);
        }
    }
}
